package log

type Log struct {
	Level            string `toml:"level" yaml:"level" env:"LOG_LEVEL"`                                        // 日志级别
	SaveFileDir      string `toml:"save_file_dir" yaml:"save_file_dir" env:"LOG_DIR"`                          // 保存文件目录
	SaveFile         bool   `toml:"save_file" yaml:"save_file" env:"LOG_SAVE_FILE"`                            // 是否保存到文件
	PrintConsole     bool   `toml:"print_console" yaml:"print_console" env:"LOG_PRINT_CONSOLE"`                // 是否打印到控制台
	ShowFullPath     bool   `toml:"show_full_path" yaml:"show_full_path" env:"LOG_SHOW_FULL_PATH"`             // 是否显示完整路径
	Separator        string `toml:"separator" yaml:"separator" env:"LOG_SEPARATOR"`                            // 日志分隔符
	PathMsgSeparator bool   `toml:"path_msg_separator" yaml:"path_msg_separator" env:"LOG_PATH_MSG_SEPARATOR"` // 只在路径和消息之间添加分隔符
	UseJSONFormat    bool   `toml:"use_json_format" yaml:"use_json_format" env:"LOG_USE_JSON_FORMAT"`
}

func NewLog() *Log {
	return &Log{
		Level:            "debug",
		SaveFileDir:      "./logs",
		SaveFile:         false,
		PrintConsole:     true,
		ShowFullPath:     false,
		Separator:        "",
		PathMsgSeparator: true,
		UseJSONFormat:    false,
	}
}
